package com.elastic.inis;

import com.elastic.ESMajorManage;
import com.elastic.chain.ChooseQuery;
import com.elastic.chain.FinalLeader;
import com.elastic.chain.Leader;

/**
 * @ClassName ESProduct
 * @Author xiezhuocai
 * @Description 用于初始化ESMajorManage
 * @Date 2021/12/30 10:20
 */
public class ESProduct {

    /**
     * @Description 需要初始化的对象
     */
    private ESMajorManage majorManage;

    ESProduct(ESMajorManage majorManage){
        this.majorManage = majorManage;
    }

    /**
     * @Description 状态
     */
    private int status = 0;


    public void initFinalLeader(FinalLeader finalLeader){
        status++;
        majorManage.setFinalLeader(finalLeader);
    }

    public void initLeader(Leader leader){
        status++;
        majorManage.setLeader(leader);
    }

    public void initChooseQuery(ChooseQuery chooseQuery){
        status++;
        majorManage.setChooseQuery(chooseQuery);
    }

    public ESMajorManage getMajorManage() {
        return majorManage;
    }

    public boolean isInit() {
        return status == 3;
    }

}
